package com.huluobo.day11_im.adapter;

import android.view.View;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.day11_im.R;
import com.hyphenate.chat.EMGroupInfo;

import java.util.List;

public class AddGroupAdapter extends BaseQuickAdapter<EMGroupInfo, BaseViewHolder> {
    public AddGroupAdapter(int layoutResId, List<EMGroupInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, EMGroupInfo emGroupInfo) {
        baseViewHolder.setText(R.id.item_add_group_tv, emGroupInfo.getGroupName());
        baseViewHolder.findView(R.id.item_add_group_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onAddClick.addClick(emGroupInfo.getGroupId());
            }
        });
    }

    public interface OnAddClick {
        void addClick(String groupId);
    }

    private OnAddClick onAddClick;

    public void setOnAddClick(OnAddClick onAddClick) {
        this.onAddClick = onAddClick;
    }
}
